Create Materialized Views
๐ <ENV> - [BigQuery] Create BigQuery Materialized Viewโ
This GitHub Actions workflow is designed to manually trigger the creation of a BigQuery Materialized View using a TypeScript helper script. It authenticates with GCP using a service account and runs the logic defined in the specified TypeScript file.
๐ Workflow Triggerโ
This workflow is triggered manually via the GitHub actions in functions repo
Required Input:โ
table_name(string): The BigQuery latest table name for which the materialized view should be created.
๐ Environment Variablesโ
| Variable | Description | 
|---|---|
GCP_PROJECT_ID | GCP Project ID (e.g., biddirect-2) | 
TABLE_NAME | Name of the latest BigQuery table (input) | 
๐ Job: deploy-bigquery-materialized-viewโ
| Step | Description | 
|---|---|
| Checkout repository | Clones the repo. | 
| Set project env variable | Stores the GCP project ID in the GitHub Actions environment. | 
| Set table name variable | Stores the input table_name in the GitHub Actions environment. | 
| Authenticate with GCP | Authenticates using a service account (ENV_BIGQUERY_ADMIN_SERVICE_ACCOUNT) stored in GitHub Secrets. | 
| Set up Cloud SDK | Installs and sets up the Google Cloud SDK CLI. | 
| Install dependencies | Runs npm install inside the functions directory. | 
| Create materialized view | Executes the helper script createMaterializedView.ts using npx ts-node. | 
๐งน Script Locationโ
The script responsible for creating the BigQuery Materialized View is located at:
functions/src/bqDataLake/definitions/views/helpers/createMaterializedView.ts
Make sure this script handles:
- Connecting to BigQuery using the provided credentials.
 - Creating the desired materialized view using the given 
TABLE_NAME. 
๐ Required Secretsโ
| Secret Name | Description | 
|---|---|
<ENV>_BIGQUERY_ADMIN_SERVICE_ACCOUNT | Service account key JSON for GCP auth. | 
โ Example Usageโ
To run this workflow:
- Go to the Actions tab in your GitHub repository.
 - Select the workflow 
<ENV> - [BigQuery] Create BigQuery Materialized View. - Enter the 
table_name(e.g.,accounts_latest). - Click "Run workflow".